<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <title>隔行变色</title>
    <script type="text/javascript">
        $(function () {
            //选择奇数变色
            $("tr:odd").css("backgroundColor","aqua");
            //选择偶数变色
            $("tr:even").css("backgroundColor","8b008b");
        });
    </script>
</head>
<body>
   <table border="1" width="800px" bgcolor="blue"><tr>
           <td>1</td>
           <td>姓名</td>
           <td>年龄</td>
       </tr>
       <tr>
           <td>2</td>
           <td>萧炎</td>
           <td>25</td>
       </tr>
       <tr>
           <td>3</td>
           <td>唐三</td>
           <td>20</td>
       </tr>
       <tr>
           <td>4</td>
           <td>林凡</td>
           <td>10000</td>
       </tr>
       <tr>
           <td>5</td>
           <td>石昊</td>
           <td>18</td>
       </tr>
       <tr>
           <td>6</td>
           <td>林动</td>
           <td>21</td>
       </tr>
       <tr>
           <td>7</td>
           <td>罗峰</td>
           <td>18</td>
       </tr>
       <tr>
           <td>8</td>
           <td>秦烈</td>
           <td>25</td>
       </tr>

   </table>
</body>
</html>